package org.openmrs.module.basicmodule.DSS.Interpreter.Function;

import org.openmrs.module.basicmodule.DSS.ast.AST;
import org.openmrs.module.basicmodule.DSS.Interpreter.InterpreterVisitor;
import org.openmrs.module.basicmodule.DSS.Interpreter.SymbolTable;
import org.openmrs.module.basicmodule.DSS.ast.IdTree;
import org.openmrs.module.basicmodule.DSS.ast.LiteralTree;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Stephen
 */
public class AlertFunction extends Function {

    @Override
    public Object execute(ArrayList args) {
        String locationToAlert = ((IdTree)args.get(0)).getSymbol().toString();
        String alert = ((AST)args.get(1)).accept(new InterpreterVisitor()).toString();
        System.out.println("#" + locationToAlert + "# $ " + alert+" $");
        return "#" + locationToAlert + "#$ " + alert +"$";

    }
}
